<template>
	<view class="demo-block">
		<text class="demo-block__title-text ultra">Icon 图标</text>
		<text class="demo-block__desc-text">iconify图标集，超过15,0000个开源矢量图标</text>
		<view class="demo-block__body">
			<view class="demo-block card">
				<text class="demo-block__title-text large">基础使用</text>
				<view class="demo-block__body">
					<view class="grid">
						<view class="grid-item">
							<l-icon name="earth" size="30px"></l-icon>
						</view>
						<view class="grid-item">
							<l-icon name="animation-1" size="30px"></l-icon>
						</view>
						<view class="grid-item">
							<l-icon name="object-storage" size="30px"></l-icon>
						</view>
						<view class="grid-item">
							<l-icon name="animation" size="30px"></l-icon>
						</view>
						<view class="grid-item">
							<l-icon name="brightness-1" size="30px"></l-icon>
						</view>
					</view>

				</view>
			</view>
			<view class="demo-block card">
				<text class="demo-block__title-text large">使用图片</text>
				<view class="demo-block__body">
					<view class="grid">
						<view class="grid-item" v-for="item in imageList" :key="item">
							<l-icon :key="item" :name="item" size="30px"></l-icon>
						</view>
					</view>
				</view>
			</view>
			<view class="demo-block card">
				<text class="demo-block__title-text large">iconify</text>
				<view class="demo-block__body">
					<view class="grid">
						<view class="grid-item">
							<l-icon size="30px" name="uil:12-plus" color="blue"></l-icon>
						</view>
						<view class="grid-item">
							<l-icon size="30px" name="icon-park-outline:abdominal"></l-icon>
						</view>
						<view class="grid-item">
							<l-icon size="30px" name="icon-park-outline:acoustic"></l-icon>
						</view>
						<view class="grid-item">
							<l-icon size="30px" name="ph:tabs-bold"></l-icon>
						</view>
						<view class="grid-item">
							<l-icon size="30px" name="ri:aliens-fill"></l-icon>
						</view>
					</view>
				</view>
			</view>
			<view class="demo-block card">
				<text class="demo-block__title-text large">自定义图标</text>
				<view class="demo-block__body">
					<view class="grid">
						<view class="grid-item">
							<l-icon size="30px" prefix="keyicon" :name="`\uE6EF`"></l-icon>
						</view>
						<view class="grid-item">
							<l-icon size="30px" :name="`\uE6EF`"></l-icon>
						</view>
					</view>
				</view>
			</view>
			<!-- <view class="demo-block card">
				<text class="demo-block__title-text large">内置图标</text>
				<view class="demo-block__body">
					<view style="height: 800rpx;">
						<list-view style="flex:1; height: 800rpx;" v-if="iconsData.length > 0">
							<list-item v-for="(group) in iconsData" :type="group">
								<view class="grid">
									<view class="grid-item" v-for="item in group" :key="item">
										<l-icon :key="item" :name="item" @click="onClick(item)" size="30px"></l-icon>
									</view>
								</view>
							</list-item>
						</list-view>
					</view>
				</view>
			</view> -->
		</view>
	</view>
</template>
<script>
	

	export default {
		data() {
			return {
				show: false,
				page: 0,
				pageSize: 10,
				iconsData: [],
				icons: [],
				customList: [
					'add-circle',
					// 'image-fill',
					// 'image-fail-fill',
					// 'close-circle-fill',
					// 'close',
				],
				imageList: [
					'https://fastly.jsdelivr.net/npm/@vant/assets/icon-demo.png',
					""
				],
				color: 'blue'
			}
		},
		created() {
			// #ifdef APP-ANDROID || APP-IOS || APP-HARMONY
			// const manager = uni.getFileSystemManager();
			// manager.readFile({
			// 	filePath: '/uni_modules/lime-icon/static/icons.json',
			// 	encoding: 'utf-8',
			// 	success: (res) => {
			// 		const obj = JSON.parseObject(res.data as string)
			// 		if(obj == null) return

			// 	}
			// } as ReadFileOptions);
			// #endif


			// let group : string[] = []
			// let groups : string[][] = []
			// let index : number = 0;

			// const _icons = UTSJSONObject.assign({}, icons)
			// _icons.toMap().forEach((_, key) => {
			// 	if (index % 5 == 0) {
			// 		group = []
			// 		group.push(key)
			// 	} else if (index % 5 == 2) {
			// 		group.push(key)
			// 		groups.push(group)
			// 	} else {
			// 		group.push(key)
			// 	}
			// 	// this.icons.push(key)
			// 	index++
			// })

			// this.icons = groups
			// this.loadData()
			// console.log(`this.icons:::`, index, this.icons)
		},
		methods: {

		},
		mounted() {

		}
	}
</script>
<style lang="scss">
	@font-face {
		font-family: keyicon;
		src: url('https://at.alicdn.com/t/c/font_4741157_ul7wcp52yys.ttf');
	}
	.keyicon {
		font-family: keyicon;
	}
	.alt {
		// background-color: aqua;
		color: blue
	}

	.grid {
		display: flex;
		// flex: 1;
		flex-direction: row;
		flex-wrap: wrap;

		&-item {
			display: flex;
			// flex-direction: column;
			flex-basis: 20%;
			align-items: center;
			padding-bottom: 10px;
			padding-top: 10px;

			&-text {
				padding-top: 10rpx;
				font-size: 22rpx;
				opacity: 0.6;
			}
		}
	}



	.demo-block {
		margin: 32px 10px 0;
		overflow: visible;

		&.card {
			padding: 20rpx 20rpx;
			background-color: white;
			margin-bottom: 20rpx !important;
		}

		&__title {
			margin: 0;
			margin-top: 8px;

			&-text {
				color: rgba(0, 0, 0, 0.6);
				font-weight: 400;
				font-size: 14px;
				line-height: 16px;

				&.large {
					color: rgba(0, 0, 0, 0.9);
					font-size: 18px;
					font-weight: 700;
					line-height: 26px;
				}

				&.ultra {
					color: rgba(0, 0, 0, 0.9);
					font-size: 24px;
					font-weight: 700;
					line-height: 32px;
				}
			}
		}

		&__desc-text {
			color: rgba(0, 0, 0, 0.6);
			margin: 8px 16px 0 0;
			font-size: 14px;
			line-height: 22px;
		}

		&__body {
			margin: 16px 0;
			overflow: visible;

			.demo-block {
				margin: 0;
			}
		}
	}
</style>